/**
* ...
* @author Default
* @version 0.1
*/

package bdz.cms.core {
	import bdz.cms.core.events.CMSEvent;
	
	import flash.net.URLVariables;
	public class CMSReader extends CMSCore{
		function CMSReader(config:CMSConfig):void {
			super(config);		
		}
		public function getCategories(parent_id:Number = 0, recurse:Boolean = false):void {
			var vars:URLVariables = new URLVariables();
			vars.method = "category.get";
			if(recurse){
				vars.recurse = 1;
			}
			vars.parent_id = parent_id;
			processData(CMSEvent.CATEGORY_LOADED, vars);
		}
		public function recurseCategories(parent_id:Number = 0):void {
			var vars:URLVariables = new URLVariables();
			vars.method = "category.recurse";
			vars.parent_id = parent_id;
			processData(CMSEvent.CATEGORY_LOADED, vars);
		}
		public function getCategoryInfo(category:Number):void {
			var vars:URLVariables = new URLVariables();
			vars.method = "content.media.get";
			vars.cat_id = category;
			processData(CMSEvent.CATEGORY_INFO_LOADED, vars);
		}
		public function getContents(category:Number):void{
			var vars:URLVariables = new URLVariables();
			vars.method = "content.get";
			vars.parent_id = category;
			
			processData(CMSEvent.CONTENT_LOADED, vars);
		}
		public function getMedia(category:Number):void{
			var vars:URLVariables = new URLVariables();
			vars.method = "media.get";
			vars.parent_id = category;
			processData(CMSEvent.MEDIA_LOADED, vars);
		}
		public function login(uname:String, pword:String):void{
			var vars:URLVariables = new URLVariables();
			vars.method = "login";
			vars.username = uname;
			vars.password = pword;
			processData(CMSEvent.LOGIN_STATUS, vars);
			
		}
		
	}
	
	
}